Ext.define('App.datacollection.executelog.view.ExecuteLogDataWindow', {
    extend: 'Ext.window.Window',
    alias: 'widget.ExecuteLogDataWindow',
    requires: ['App.datacollection.executelog.view.ExecuteLogDataList'],
    height: 600,
    width: 1000,
    layout: 'fit',
    title: '运行日志',
    modal: true,
    listeners: {
        show: function () {
            var me = this;
            Ext.Ajax.request({
                url: "datacollection/executelog/query",
                params: {'params.taskInstance.id': me.taskInstanceId, 'pageable.size': 10000},
                method: 'POST',
                success: function (response, options) {
                    if (response.result.success) {
                        if (response.result.data.length > 0) {
                            var lines = [];
                            response.result.data.forEach(function (value, index, row) {
                                lines.push("【" + value.datetime.replace("T", " ") + "】 -> " + value.log);
                            })
                            me.down("textarea").setValue(lines.join("\n\r"))
                        }
                    }
                }
            });
        }
    },
    constructor: function () {
        this.items = [{xtype: 'textarea', fieldStyle: {"white-space": "nowrap", "overflow": "scroll"}}];
        this.callParent(arguments);
    }
})
